﻿Imports BUS
Imports DTO
Public Delegate Sub delClose(ByVal sender As Object, ByVal e As EventArgs)
Public Class frmDangnhap

    Private Sub DangNhap1_SuKienDangNhap(ByVal Tendangnhap As System.String, ByVal matkhau As System.String) Handles DangNhap1.SuKienDangNhap
        'kiem tra ten dang nhap va mat khau co trung khong
        Dim dto As DtoMatkhau = New DtoMatkhau()
        Dim err As String = String.Empty
        dto.Ten = Tendangnhap
        dto.Pass = matkhau
        Dim flag As Integer = BusMatkhau.KiemTraDangnhap(dto, err)
        If (flag = 0) Then
            MessageBox.Show(err)
        Else
            Dim frmMain As frmMain = New frmMain()
            frmMain.Tendangnhap = Tendangnhap
            frmMain.delclose = New delClose(AddressOf DangNhap1_SukienThoat)
            Me.Visible = False
            frmMain.Show()
        End If
       
    End Sub

    Private Sub DangNhap1_SukienThoat(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DangNhap1.SukienThoat
        Me.Close()
    End Sub
End Class